package com.fhj.movie.customespinner;

import java.util.List;

import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.fhj.movie.entity.JyjDistrictEntity;

public class MovieLeftAdapter extends BaseAdapter {

	private Context  context;
	private List<JyjDistrictEntity>	list;
	
	public void init(Context context, List<JyjDistrictEntity> list){
		this.context = context;
		this.list  = list;
	}
	
	@Override
	public int getCount() {
		// TODO 自动生成的方法存根
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO 自动生成的方法存根
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO 自动生成的方法存根
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO 自动生成的方法存根
		SpinnerViewHolderLeft viewHolder = null;
		if (convertView==null) {
			viewHolder = new SpinnerViewHolderLeft();
			viewHolder.textView = new TextView(context);
			convertView = viewHolder.textView;
			convertView.setTag(viewHolder);
			viewHolder.textView.setTextColor(Color.BLACK);
			viewHolder.textView.setTextSize(15);
			viewHolder.textView.setGravity(Gravity.CENTER);
			viewHolder.textView.setPadding(8, 8, 8, 8);
		}else {
			viewHolder = (SpinnerViewHolderLeft) convertView.getTag();
		}
		viewHolder.textView.setText(""+list.get(position).getName());
		return convertView;
	}
}
